package com.logictech.lims.dao.impl;

import java.util.List;

import org.jeecgframework.p3.core.utils.common.PageQuery;
import org.jeecgframework.p3.core.utils.common.PageQueryWrapper;
import org.jeecgframework.p3.core.utils.persistence.mybatis.GenericDaoDefault;
import org.springframework.stereotype.Repository;

import com.logictech.lims.dao.ReagentInventoryDao;
import com.logictech.lims.dto.ReagentInventoryDto;
import com.logictech.lims.entity.ReagentInventory;

/**
 * 描述：</b>ReagentInventoryDaoImpl<br>
 * @author：guoqi
 * @since：2017年03月21日 16时10分44秒 星期二 
 * @version:1.0
 */
@Repository("reagentInventoryDao")
public class ReagentInventoryDaoImpl extends GenericDaoDefault<ReagentInventory> implements ReagentInventoryDao{

	@Override
	public Integer count(PageQuery<ReagentInventoryDto> pageQuery) {
		return (Integer) super.queryOne("count",pageQuery);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<ReagentInventoryDto> queryPageList(
			PageQuery<ReagentInventoryDto> pageQuery,Integer itemCount) {
		PageQueryWrapper<ReagentInventoryDto> wrapper = new PageQueryWrapper<ReagentInventoryDto>(pageQuery.getPageNo(), pageQuery.getPageSize(),itemCount, pageQuery.getQuery());
		return (List<ReagentInventoryDto>)super.query("queryPageList",wrapper);
	}

	@Override
	public int getMaxNo(String no){
		String maxNo = (String) super.queryOne("getMaxNo",no);
		if(maxNo == null){
			return 0;
		}
		return Integer.parseInt(maxNo);
	}

	@Override
	public ReagentInventoryDto queryByNo(String barCode) {
		return (ReagentInventoryDto)super.queryOne("queryByNo",barCode);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<ReagentInventoryDto> queryList(PageQuery<ReagentInventoryDto> pageQuery) {
		return super.query("queryList",pageQuery);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<ReagentInventoryDto> getToPrintList() {
		return (List<ReagentInventoryDto>)super.query("getToPrintList",new Object());
	}

	@Override
	public List<ReagentInventoryDto> getMinEffectiveDate(Integer reagentTypeId) {
		return (List<ReagentInventoryDto>)super.query("getMinEffectiveDate",reagentTypeId);
	}

}

